﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using HGZP.BLL;
using HGZP.Model;
using HGZP.PLL;
using System.Data;
namespace SZCB.admin.Function
{
    public partial class AddFunctionClass : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// 提交按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            CFunctionClassBLL myCFunctionClassBLL = new CFunctionClassBLL();
            DataTable dt = myCFunctionClassBLL.F02_SelectHaveWhere("sName = '" + txtName.Text + "'");
            if (dt.Rows.Count > 0)
            {
                string strErrmessage = "该功效大类已添加";
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + strErrmessage + "');</script>");
                return;
            }
            CFunctionClass myCFunctionClass = new CFunctionClass();
            myCFunctionClass.sGuid = MyFunction.GetNewGuid();
            myCFunctionClass.sName = txtName.Text;
            myCFunctionClass.dCeateDate = DateTime.Now;
            if (!myCFunctionClassBLL.F_Insert(myCFunctionClass))
            {
                string strErrmessage = "添加功效大类失败";
                Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + strErrmessage + "');</script>");
                return;
            }

        }

    }
}